package com.vzoom.logdesensitization.strategyimpl;

import com.vzoom.logdesensitization.DesensitizationStrategy;
import com.vzoom.logdesensitization.util.StarUtil;

public class NameDesensitizationStrategy implements DesensitizationStrategy {
    @Override
    public String desensitization(Object origin) {
        String toString = String.valueOf(origin);
        if (origin == null || "".equals(origin)) {
            return toString;
        }
        int length = toString.length();
        return toString.charAt(0) + StarUtil.getStar(length - 1);
    }
}
